<% layout('/layouts/default.html', {title: '考试预约管理', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${smTestOrder.isNewRecord ? '新增考试预约' : '编辑考试预约'}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${smTestOrder}" action="${ctx}/tm/smTestOrder/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">考试信息</div>
				<#form:hidden path="id"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考生姓名：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:listselect path="studentId" labelPath="student.name" id="studentIdSelect" title="考生"
								url="${ctx}/sm/smStudent/studentSelect" allowClear="false"
								checkbox="false" itemCode="id" itemName="name"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 性别：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="student.sex" dictType="sys_user_sex" blankOption="true" disabled="disabled" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 证件类型：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="student.cardType" blankOption="true" dictType="DSMS_ZJLX" disabled="disabled" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考生证件号：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="student.idno" maxlength="50" readonly="true" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考生电话：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="student.telephone" maxlength="20" readonly="true" class="form-control required phone"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考试类型：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="student.studyType" blankOption="true" dictType="DSMS_BKLX" disabled="disabled" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 是否本校：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="student.isSchool" blankOption="true" dictType="sys_yes_no" disabled="disabled" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 是否VIP：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="student.isVip" blankOption="true" dictType="sys_yes_no" disabled="disabled" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考试科目：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="subject" dictType="DSMS_KSKM" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考试场地：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="testAddr" dictType="DSMS_KSCD" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>


				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考试日期：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="testDate" readonly="true" maxlength="20" class="form-control Wdate required date"
										dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 预约时间：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="orderDate" readonly="true" maxlength="20" class="form-control Wdate required date"
										dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required ">*</span> 所属驾校：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:treeselect id="officeId" title="驾校"
                                path="officeId" labelPath="school.officeName"
                                url="${ctx}/sys/office/treeData"
                                class=" required" allowClear="true"/>
                            </div>
                        </div>
                    </div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 驾校负责人：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="school.leader" maxlength="50" readonly="true" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 驾校电话：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="school.phone" maxlength="20" readonly="true" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> 考试状态：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="testStatus" dictType="DSMS_KSZT" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> 备注：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:textarea path="remarks" rows="4" maxlength="255" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('tm:smTestOrder:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
$(document).ready(function(){
    $('#studentIdSelectCode').change(function(e){
       var studentId = e.target.value;
	   $.get("${ctx}/sm/smStudent/get?id="+studentId,function(res){
           $("#student_sex").val(res.sex).select2();
           $("#student_cardType").val(res.cardType).select2();
           $("#student_idno").val(res.idno);
           $("#student_telephone").val(res.telephone);
           $("#student_studyType").val(res.studyType).select2();
           $("#student_isVip").val(res.isVip).select2();
           $("#student_isSchool").select2('val',res.isSchool);
	   });
	});
    $('#officeIdCode').change(function(e){
       var officeCode = e.target.value;
	   $.get("${ctx}/sys/office/get?officeCode="+officeCode,function(res){
           $("#school_leader").val(res.leader);
           $("#school_phone").val(res.phone);
	   });
	});
});
</script>